/**
 * Created by gongxun on 16/11/20.
 */

var KwxRoomMsgLayer = KwxBaseLayer.extend({
    ctor : function (msg) {
        this._super();

        this.loadCocostudio("res/ccs/KwxRoomMsgLayer.json");
        mo.gameHelper.fixIosText(this.ccsNode);

        mo.gameHelper.setTextString(mo.seekWidgetByName(this.ccsNode, "Text_msg"), msg);

        var that = this;
        mo.seekWidgetByName(this.ccsNode, "Image_bg").runAction(
            cc.sequence(cc.delayTime(2), cc.moveBy(0.2, cc.p(0, 100)), cc.delayTime(1), cc.callFunc(function(){
                that.removeFromParent();
            }))
        );

        mo.soundHelper.playDialogOpen();
    }
});

mo.showRoomMsgShow = function(msg){
    var layer = new KwxRoomMsgLayer(msg);
    mo.sceneMainLayer.addChild(layer);
};